/**
 * 
 */
package org.compiere.model;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;

import org.compiere.report.ReportPayroll.PayrollList;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;

/**
 * @author V.Sokolov
 *
 */
public class Mhrmreservesectional extends X_hrm_reservesectional {


	/**
	 * 
	 */
	private static final long serialVersionUID = 179982720252807878L;
	
	/**	Static Logger	*/
	private static CLogger	s_log	= CLogger.getCLogger (Mhrmreservesectional.class);

	/**
	 * @param ctx
	 */
	public Mhrmreservesectional(Properties ctx) {
		super(ctx);
	}
	
	/**
	 * @param ctx
	 * @param hrm_reserve_ID
	 * @param trxName
	 */
	public Mhrmreservesectional(Properties ctx, int hrm_reserve_ID, String trxName) {
		super(ctx, hrm_reserve_ID, trxName);
	}
	
	/**
	 * @param ctx
	 * @param rs
	 * @param trxName
	 */
	public Mhrmreservesectional(Properties ctx, ResultSet rs, String trxName) {
		super(ctx, rs, trxName);
	}
	
	public static Mhrmreservesectional[] getMhrmreservesectional(){
		
		
		List<Mhrmreservesectional> list = new ArrayList<Mhrmreservesectional>();
		Mhrmreservesectional value = null;
		
		PreparedStatement pstmt = null;
		ResultSet rs = null;		
		try
		{
			pstmt = DB.prepareStatement("SELECT * FROM HRM_RESERVESECTIONAL WHERE ISACTIVE='Y' \n" +
					"AND AD_CLIENT_ID= "+Env.getAD_Client_ID(Env.getCtx())+" \n" +
					"AND AD_ORG_ID=" +Env.getAD_Org_ID(Env.getCtx())+ " \n ORDER BY HRM_RESERVESECTIONAL_ID",null);
			rs = pstmt.executeQuery();	
					
			while (rs.next ())
			{
				value = new Mhrmreservesectional(Env.getCtx(), rs, null);
				list.add(value);
			}
		}
		catch (SQLException e)
		{
			s_log.log(Level.SEVERE, "product", e);
		}
		finally
		{
			DB.close(rs, pstmt);
			rs = null; pstmt = null;
		}	
		
		return list.toArray(new Mhrmreservesectional[list.size()]);
	
	}
	
	
}
